import Vue from 'vue'

// directive.js文件
Vue.directive('loadMore', {
  bind(el, binding) {
    const bodyWrapper = el.querySelector('.el-table__body-wrapper')

    bodyWrapper.addEventListener('scroll', function() {
      const scrollDistance = this.scrollHeight - this.scrollTop - this.clientHeight
      console.log(scrollDistance)
      // 触底加载下一页
      if (scrollDistance <= 10) {
        binding.value()
      }
    })
  }
})
